<div class="row">

    <div class="col-md-12">       

        <div class="block">
            <div class="block-title">
                <h2><strong>Formulario de Preinscripcion </strong> </h2>
            </div>
           
                <?php echo $this->Form->create('User', array('action' => 'guarda_colegiado','class'=>'form-horizontal form-bordered','enctype' => 'multipart/form-data'),array('type' => 'file'));?>	    
                <fieldset>
                    <!--<legend><i class="fa fa-angle-right"></i> Vital Info</legend>-->
                    <div class="form-group">
                        
                        
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label" for="data[User][ap_paterno]">Apellido Paterno <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->hidden('id');?>
                                <?php echo $this->Form->hidden('role');?>
                                <?php echo $this->Form->text('ap_paterno',array('class' => 'form-control','placeholder' => 'Ingrese el apellido paterno'));?>
                                <span class="input-group-addon"><i class="gi gi-user"></i></span>
                            </div>
                        </div>

                        <label class="col-md-2 control-label" for="data[User][ap_materno]">Apellido Materno <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('ap_materno',array('class' => 'form-control','placeholder' => 'Ingrese el apellido paterno'));?>
                                <span class="input-group-addon"><i class="gi gi-user"></i></span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label" for="data[User][nombres]">Nombres <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('nombres',array('class' => 'form-control','placeholder' => 'Ingrese los nombres','required'));?>
                                <span class="input-group-addon"><i class="gi gi-user"></i></span>
                            </div>
                        </div>
                        <label class="col-md-2 control-label">C.I. <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('ci',array('class' => 'form-control','placeholder' => 'Ingrese el C.I.','required'));?>
                                <span class="input-group-addon"><i class="gi gi-user"></i></span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label class="col-md-2 control-label" for="data[User][fecha_titulo]">Fecha de Titulo <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('fecha_titulo',array('class' => 'form-control input-datepicker','data-date-format' => 'yyyy-mm-dd','placeholder' => 'seleccione la fecha','required','disabled'));?>
                                <span class="input-group-addon"><i class="hi hi-calendar"></i></span>
                            </div>
                        </div>
                        <label class="col-md-2 control-label">Ingenieria <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->select('categoria_id',$categorias,array('class' => 'form-control','required'));?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">RNI <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->tex('rni',array('id'=>'rni','class' => 'form-control','required'));?>
                        </div>
                        <label class="col-md-2 control-label">Fecha Asignacion <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('fecha_asignacion',array('class' => 'form-control input-datepicker','data-date-format' => 'yyyy-mm-dd','placeholder' => 'seleccione la fecha','required'));?>
                                <span class="input-group-addon"><i class="hi hi-calendar"></i></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">Pais <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->select('paise_id',$paises,array('class' => 'form-control','required'));?>
                        </div>
                        <label class="col-md-2 control-label">Departamento <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->select('ciudade_id',$ciudades,array('class' => 'form-control','required'));?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">Domicilio <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->text('domicilio',array('class' => 'form-control'));?>
                        </div>
                        <label class="col-md-2 control-label">Telefono <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->text('telefono',array('class' => 'form-control'));?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">Fecha de Nacimineto <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('fecha_nacimiento',array('class' => 'form-control input-datepicker','data-date-format' => 'yyyy-mm-dd','placeholder' => 'seleccione la fecha','required'));?>
                                <span class="input-group-addon"><i class="hi hi-calendar"></i></span>
                            </div>
                        </div>
                        <label class="col-md-2 control-label">Genero <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->select('genero',array('Masculino' => 'Masculino','Femenino' => 'Femenino'),array('class' => 'form-control','required'));?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">Celular <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->text('celular',array('class' => 'form-control'));?>
                        </div>
                        <label class="col-md-2 control-label">Email <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->text('email',array('class' => 'form-control'));?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">Tipo <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <?php echo $this->Form->select('tipo',array('Nacional' => 'Nacional','Extranjero' => 'Extranjero','Tecnico' => 'Tecnico'),array('class' => 'form-control','required','disabled'));?>
                        </div>
                        <label class="col-md-2 control-label" for="example-file-input">Foto .jpg</label>
                        <div class="col-md-3">
                            <?php echo $this->Form->file('foto',array('class' => 'form-control','accept' => 'image/jpeg'))?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">Usuario <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('username',array('class' => 'form-control','disabled','placeholder' => 'espere la asignacion de usuario'));?>
                                <span class="input-group-addon"><i class="gi gi-user"></i></span>
                            </div>
                            <?php 
                            if(empty($this->request->data['User']['username']))
                            {
                                $deshabilita = 'disabled';
                            }
                            else{
                                $deshabilita = '';
                            }
                            ?>
                        </div>
                        <label class="col-md-2 control-label">Nuevo password <span class="text-danger">*</span></label>
                        <div class="col-md-3">
                            <div class="input-group">
                                <?php echo $this->Form->text('password_n',array('class' => 'form-control','placeholder' => 'Ingrese nuevo password',$deshabilita));?>
                                <span class="input-group-addon"><i class="gi gi-keys"></i></span>
                            </div>
                            
                        </div>
                    </div>
                    <div class="form-group">
                        
                        <label class="col-md-2 control-label" for="data[User][observaciones]">Observaciones <span class="text-danger">*</span></label>
                        <div class="col-md-8">
                            <?php echo $this->Form->textarea('observaciones',array('class' => 'form-control col-md-12','placeholder' => 'Aqui las observaciones'))?>
                            
                        </div>
                    </div>  
                   
                    

                </fieldset>

                <div class="form-group form-actions">
                    <div class="col-md-8 col-md-offset-4">
                        <button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-arrow-right"></i> Guardar</button>
                    </div>
                </div>
            <?php echo $this->Form->end();?>

        </div>
    </div>    
</div>
<script>
    $("#rni").click(function(){
        if($("#rni").val()==empty){
            //alert('asignar rni!!');
            $("#rni").css("display","none");
        }else{
            //alert('correcto');
            $("#rni").css("display","block");
        }
    });
</script>